<template>
	<view class="container">
		<!-- <view :class="[popup_show?'popup_layer popup_show':'popup_layer']">
			<view class="wenxintishi-cont">
				<view class="popup_bg"></view>
				<!-- 使用引导 -->
		<!-- <view class="promptPop">
					<view class="prompt-title">温馨提示</view>
					<view class="prompt-text">
						<view class="prompt-text-infor">1、为向您提供基本服务，我们会遵循正当，合法，必要的原则收集和使用必要的信息；</view>
						<view class="prompt-text-infor">2、基于您的授权我们可能会收集和使用您的位置信息，设备信息，以及存储器，您有权拒绝或取消授权；</view>
						<view class="prompt-text-infor">3、获取位置信息主要用于为您推荐所在地区的相关招标信息；</view>
						<view class="prompt-text-infor">4、获取摄像头权限主要用于扫描登陆采招网PC端；</view>
						<view class="prompt-text-infor">5、未经您同意我们不会将您的信息共享给任何第三方或用于您未授权的其它用途；</view>
						<view class="prompt-text-infor">6、您可以对上述信息进行访问、更正、删除以及注销帐户采招网将一如既往的为您提供服务；</view>
						<view class="prompt-text-infor">7、为保障您的权益，请您在点击确认之前仔细阅读并充分理解<text style="color:#007AFF;" @click="fuwutiaokuan">《采招网服务条款》</text> 及 <text style="color:#007AFF;"
								@click="yinsixieyi">《采招网隐私政策》</text>全部内容；</view>
					</view>
					<view class="prompt-btn">
						<view class="prompt-btn-agree1" @click="notagreeBid">不同意</view>
						<view class="prompt-btn-agree2" @click="agreeBid">同意并继续</view>
					</view>
				</view>
			</view>
		</view> -->
		<view :class="[syyd_show?'popup_layer popup_show':'popup_layer']">
			<view class="popup_bg"></view>
			<view class="syyd-content">
				<view class="syyd-step1" @tap="NextStep()" v-bind:class="[IsShow1 ? 'showImg':'hideImg']"
					:style="{top: navBar + logoBox + 'px'}">
					<image src="/static/img/guide/syyd-step1.png" class="syyd-step1-img" mode="widthFix"></image>
				</view>
				<view class="syyd-step2" v-bind:class="[IsShow2 ? 'showImg':'hideImg']" @tap="NextStep2()"
					:style="{top: navBar + HeaderBox + ZbBox + 'px'}">
					<image src="/static/img/guide/syyd-step2.png" class="syyd-step1-img" mode="widthFix"></image>
				</view>
				<view class="syyd-step3" v-bind:class="[IsShow3 ? 'showImg':'hideImg']" @tap="NextStep3()"
					:style="{top: navBar + HeaderBox + ZbBox + 50 + 'px'}">
					<image src="/static/img/guide/syyd-step3.png" class="syyd-step1-img" mode="widthFix"></image>
				</view>
				<view class="syyd-step4" v-bind:class="[IsShow4 ? 'showImg':'hideImg']" @tap="NextStep4()">
					<image src="/static/img/guide/syyd-step4.png" class="syyd-step1-img" mode="widthFix"></image>
				</view>
				<view class="syyd-step5" v-bind:class="[IsShow5 ? 'showImg':'hideImg']" @tap="NextStep5()">
					<image src="/static/img/guide/syyd-step5.png" class="syyd-step1-img" mode="widthFix"></image>
				</view>
			</view>
			<view class="jumpover" @tap="launchFlag()">{{ jumpover }}</view>
		</view>
		<view class="searchFixed">
			<view class="headerHight" @touchmove="clearList()">
				<uni-nav-bar :fixed="false" :status-bar="true" color="#fff" background-color="#1B18F7">
					<template v-slot:left>
						<view class="city">
							<view><text class="uni-nav-bar-text">{{ cityName==''?'全国':cityName }}</text></view>
							<!-- <view class="arrowsicon"> </view> -->
						</view>
					</template>
					<template v-slot:right>
						<view class="scan-box" @click="scan(false)">
						    <u-icon name="scan" color="#fff" size="30" ></u-icon>
							<view class="scan-text"  >扫一扫</view>
						</view>

					</template>
				</uni-nav-bar>
			</view>
			<view class="header">
				<view class="logo" @touchmove="clearList()">
					<image src="/static/img/home/logo.png"></image>
				</view>
				<view class="input-view">
					<uni-icons class="input-uni-icon" type="search" size="22" color="#666666" />
					<input class="nav-bar-input" v-model="keywords" type="text" placeholder="大家都在搜“装修”" auto-blur="true"
						@confirm="confirm" @input="getAutocompleteList(keywords)" @blur="clearAutocompleteList">
					<view class="button" @click="searchPage">搜索</view>
					<scroll-view class="search-history" v-show="AutocompleteList.length" :scroll-top="searchScrollTop"
						scroll-y="true" @scroll="searchScroll">
						<view class="history-list" v-for="(word,index) in AutocompleteList" :key="index"
							@tap.stop="searchByCompleteKeyWord(word.title)" @touchmove="clearListTimeStatus">
							<text v-html="Completeheighthtml(keywords,word.title)" class="hot-list_item"></text>
						</view>
					</scroll-view>
				</view>
				<view class="hot-key" @touchmove="clearList()">
					<image src="/static/img/home/hot.png" class="hot"></image>
					<view class="hot-list" v-for="(wlist,index) in wordlist" :key="index">
						<text class="hot-list_item" @click="hotPage(wlist)">{{wlist}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="content-box" :style="{top: navBar + HeaderBox + 'px'}" @touchmove="clearList()">
			<view class="zbqy">
				<image src="/static/img/home/zhongbiao.png" class="zb-icon"></image>
				<view class="zbqy-name">
					<!-- <screenTextScroll :list="hotlist" /> -->
					<swiper style="height: 46rpx; line-height: 46rpx;" :indicator-dots="indicatorDots" :vertical="vertical"
						:autoplay="autoplay" :interval="interval" :duration="duration">
						<swiper-item v-for="(item,index) in hotlist" :key="index" @click="zhongbiaoDetail(item)">
							<view class="swiper-item">{{item.title}}</view>
						</swiper-item>
					</swiper>
				</view>
			</view>
			<view class="navlist-list">
				<view class="navlist-list_item" v-for="(navlist, index) in navlists" :key="navlist.url"
					@click="goPage(navlist)">
					<image :src="navlist.src" class="navlist-list_item-icon"></image>
					<text class="navlist-list_item-text">{{navlist.title}}</text>
				</view>
			</view>
			<view class="adv-swiper" style="margin: 0 30rpx 30rpx;"  v-if="!baseConfig.isIOSshenhe">
				<!-- 轮播 -->
				<!-- <swiper class="swiper" indicator-color="rgba(255, 255, 255, 0.6)"
					indicator-active-color="rgba(255, 255, 255, 1)" :autoplay="true" :interval="3000" :duration="1000"
					:current="swiperCurrent" @change="changeSwiper">
					<swiper-item v-for="item in swiperImg" :key="item.id" @click="goToPage(false, item.type, item.url)">
						<image class="swiper-item" :src="item.src" mode="widthFix"></image>
					</swiper-item>
				</swiper> -->
				<!-- 轮播指示点样式修改 -->
				<!-- <view class="dots">
					<block v-for="(item,index) in swiperImg.length" :key="item">
						<view class="dot" :class="index==swiperCurrent ? ' active' : ''"></view>
					</block>
				</view> -->
				
				<u-swiper :list="swiperImg" height="75" keyName="src"  indicator indicatorMode="line" circular @click="clickSwiper"></u-swiper>
			</view>
			<!-- <input class="jbxx-input" v-model="this.initNewData().guid" type="text" /> -->
			<!-- 顶部选项卡 -->
			<scroll-view id="nav-bar" class="nav-bar" scroll-x scroll-with-animation :scroll-left="scrollLeft">

				<view v-for="(item,index) in indextabBars" :key="item.value" class="nav-item"
					:class="{current: index == tabCurrentIndex}" :id="'tab'+index" @click="changeTab(index)">
					{{item.title}}
				</view>

			</scroll-view>
			<!-- 内容部分 -->
			<swiper id="swiper" class="swiper-box" :style="{paddingBottom:screenWidth==375 ? '500rpx': '220rpx'}" :duration="300" :current="tabCurrentIndex" @change="changeTab">
				<swiper-item v-for="tabItem in indextabBars" :key="tabItem.value">
					<scroll-view class="panel-scroll-box" :scroll-y="enableScroll">
						<view class="uni-list">
							<view class="uni-list-cell" hover-class="uni-list-cell-hover"
								v-for="(item, index) in tabItem.indexnewsList" :key="index" @click="navToDetails(item)">
								<view v-if="tabShowZb(tabCurrentIndex)">
									<view class="list-cell-title">
										<text class="item-badge"
											v-if="item.type==1&&item.zhaobiaozhong==1">招标中</text><text
											:style="isInArray(clickedid,item.id)?'color:gray':''">{{item.title}}</text>
									</view>
									<view class="list-cell-bottom">
										<text class="list-area">{{item.diqu}} {{item.diqucity}}</text>
										<text class="list-category">{{item.typeStr}}</text>
										<!-- <text class="list-areal">62309.24平方</text> -->
										<view class="list-filel" v-if="item.fujian==2">
											<image src="/static/img/home/fujian.png" class="filel-icon"></image>
											<text class="text-blue">有附件</text>
										</view>
										<view class="list-filel" v-if="item.fujian==1">
											<image src="/static/img/biaoshu.png" class="filel-icon"></image>
											<text class="text-green">有标书</text>
										</view>
										<text class="list-time">{{item.time}}</text>
									</view>
								</view>
								<view v-else>
									<view class="title">{{item.title}}</view>
									<view class="xmlist-tag">
										<text class="xmlist-tag-item">{{item.jieduanStr}}</text><text
											class="xmlist-tag-item xmlist-tag-item-gj">{{item.genjincount}}人跟进</text><text
											class="xmlist-tag-item">{{item.typeStr}}</text>
										<!-- <text class="xmlist-tag-item">{{item.}}</text> -->
									</view>
									<view class="xmlist-bottom">
										<view class="xmlist-area">
											<image src="/static/img/home/tubiao_17.png"></image>
											<text>{{item.diqu}}</text>
										</view>
										<view class="xmlist-area">
											<image src="/static/img/home/tubiao_19.png"></image>
											<text>{{item.time}}</text>
										</view>
									</view>
								</view>
							</view>
							<view class="bottom-custom" :class="{'moreList': tabItem.editModel}">

								<view class="custom-btn" @click="MoreInforList(tabCurrentIndex)">点击查看更多</view>
								<view class="custom-foot">我是有底线的</view>
							</view>
							<mix-load-more :status="tabItem.Status"></mix-load-more>
						</view>

					</scroll-view>
				</swiper-item>

			</swiper>
			<view class="footBox" >
				<z-navigation></z-navigation>
			</view>
		</view>

		<!-- 返回顶部 -->
		<!-- <view class="backTop">
			<image src="/static/img/goTop.png"></image>
		</view> -->
		<!-- 付费地区 -->
		<!-- <view class="fufeidiqu">
			付费地区
		</view> -->

		<uni-popup ref="showPopAd" type="center" :mask-click="true">
			<view class="welfare" v-if="!this.popup_show &&Adbig.info.src!=''&&isshowTopAd(Adbig.enddate)">
				<view class="welfare_cont">
					<image :src="Adbig.info.src" mode="widthFix" class="activity-pic"
						@click="goToPage(Adbig.mustlogin, Adbig.info.type, Adbig.info.url)"></image>
				</view>
				<image src="/static/guanbi.png" class="receive-close"
					@click="$refs['showPopAd'].close();isshowadbig=false;"></image>
			</view>
		</uni-popup>
		<view class="welfare-small"
			v-if="!this.popup_show &&Adsmall.info.src!=''&&!isshowadbig&&isshowTopAd(Adsmall.enddate)">
			<view class="welfare-box">
				<image :src="Adsmall.info.src"
					@click="goToPage(Adsmall.mustlogin, Adsmall.info.type, Adsmall.info.url)"></image>
			</view>
		</view>
	</view>
</template>

<script>
	import zNavigation from '@/components/navigation/navigation.vue';
	import uniIcons from '@/components/uni-icons/uni-icons.vue'
	import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue'
	import uLink from "@/components/uLink.vue"
	import data_newstype from '@/common/static/data-newstype.js';
	import mixLoadMore from '@/components/mix-load-more/mix-load-more';
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	import Autocomplete from '@/mixins/Autocomplete.js';
	import dateutil from '@/common/script/dateUntil.js';
	let windowWidth = 0,
		scrollTimer = false,
		tabBar;
	let windowHeight = 500
	export default {
		components: {
			uniNavBar,
			uniIcons,
			uLink,
			mixLoadMore,
			zNavigation
		},
		data() {
			return {
				
				topHeight: false,
				IsShow1: true,
				IsShow2: false,
				IsShow3: false,
				IsShow4: false,
				IsShow5: false,
				jumpover: '跳过',
				experience: '立即体验',
				navBar: 0,
				logoBox: 0,
				HeaderBox: 0,
				ZbBox: 0,
				footBox: 0,
				navListHei: 0,
				syyd_show: false,
				indicatorDots: false,
				autoplay: true,
				interval: 3000,
				duration: 500,
				vertical: true,
				isFixed: false,
				//同意采招网隐私政策
				popup_show: false,
				editModel: true,
				cityName: '全国',
				cityCode: '',
				wordlist: [],
				hotlist: [],
				swiperHeight: '200px',
				navlists: [{
						src: '/static/img/function/gn_zb.png',
						title: '招标查询',
						url: '/pages/search/searchList?t=1',
						type: 'nav',
						ischecklogin: false
					},
					{
						src: '/static/img/function/gn_zhongbiao.png',
						title: '中标查询',
						url: '/pages/search/searchList?t=4',
						type: 'nav',
						ischecklogin: false
					},
					{
						src: '/static/img/function/gn_nzj.png',
						title: '拟在建项目',
						url: '/pages/search/searchList?t=3',
						type: 'nav',
						ischecklogin: false
					},
					{
						src: '/static/img/function/gn_hyzb.png',
						title: '会员招标',
						url: '/pages/index/huiyuanzhaobiao/huiyuanzhaobiao',
						type: 'nav',
						ischecklogin: false
					},
					{
						src: '/static/img/function/gn_bs.png',
						title: '标书代写',
						url: '/pages/index/biaoshu/biaoshu-webview',
						type: 'nav',
						ischecklogin: false
					},

					{
						src: '/static/img/function/gn_clh.png',
						title: '采乐会',
						url: '/pages/index/cailehui/cailehui-webview',
						type: 'nav',
						ischecklogin: false
					},
					{
						src: '/static/img/function/gn_wk.png',
						title: '微课',
						url: '/pages/index/weike/weike-webview',
						type: 'nav',
						ischecklogin: false

					},
					{
						src: '/static/img/function/gn_dsj.png',
						title: '招投标数据',
						url: "/pages/index/zhaotoubiao/zhaotoubiao-webview",
						type: 'nav',
						ischecklogin: false
					},
					{
						src: '/static/img/function/gn_zbpx.png',
						title: '招标培训',
						type: 'nav',
						ischecklogin: false
					},
					{
						src: '/static/img/function/gn_gd.png',
						title: '更多功能',
						url: '/pages/index/function/function',
						type: 'nav',
						ischecklogin: true
					}
				],
				swiperImg: [],
				current: 0,
				swiperCurrent: 0,
				tabCurrentIndex: 0, //当前选项卡索引
				scrollLeft: 0, //顶部选项卡左滑距离
				enableScroll: false,
				indextabBars: [],
				firstload: true,
				locationName: '',
				keywords: '',
				navbarheight: 0,
				clickedid: [],
				adbigimg: '',
				adsmallimg: '',
				isshowadbig: false,
				//弹窗广告
				Adbig: {
					info: {
						title: '',
						url: '',
						src: '',
						type: '',
						typeno: '',
					},
					enddate: '1900-01-01',
					mustlogin: false
				},
				//右侧广告
				Adsmall: {
					info: {
						title: '',
						url: '',
						src: '',
						type: '',
						typeno: ''
					},
					enddate: '1900-01-01',
					mustlogin: false
				},
				channel: '',
				screenWidth:0,
			};
		},
		async onShow() {
			
			// let pages = getCurrentPages();
			// let currPage = pages[pages.length - 1];
			// console.log(currPage);
			// let city = currPage.city;
			// if (currPage && currPage.city != undefined && currPage.city.name != '') {
			// 	this.cityName = city.cityName;
			// 	this.cityCode = city.cityCode;
			// 	this.loadNewsList('city');
			// 	this.firstload = false;
			// }
			uni.hideNavigationBarLoading(); //关闭加载动画
			// 隐藏原生的tabbar
			this.loadHot();
			uni.hideTabBar();

			//如果是小米渠道包，则不显示招标培训
			let channel = getApp().globalData.channel
			if (channel == 'xiaomi') {
				this.navlists = this.navlists.filter((item) => item.title !== "招标培训")
			}
		},
		onLoad() {
			this.guide();

			if (uni.getSystemInfoSync().platform === 'ios') {
				// this.navlists=this.navlists.slice(1)
				this.navlists = this.navlists.filter(item => item.title !== '招标培训')
			}
			//this.agreeBind();
			// 获取屏幕宽度
			windowWidth = uni.getSystemInfoSync().windowWidth;

			this.loadTabbars();
			// #ifdef APP-PLUS
			//this.getlocation();
			// #endif 
			//第一次安装不加载广告 防止弹出层重叠
			if (!this.syyd_show && !this.popup_show)
				this.loadHot(1);
		},
		mounted() {
			// #ifdef APP-PLUS
			plus.navigator.closeSplashscreen();
			// #endif
			const query = uni.createSelectorQuery().in(this);
			uni.createSelectorQuery().in(this).select('.input-view').boundingClientRect(data => {
				this.myScroll = data.top
				this.navbarheight = data.height
			}).exec();
			uni.createSelectorQuery().in(this).select('.headerHight').boundingClientRect(data => {
				this.navBar = data.height
				//console.log(this.navBar)
			}).exec();
			uni.createSelectorQuery().in(this).select('.logo').boundingClientRect(data => {
				this.logoBox = data.height
				//console.log(this.logoBox)
			}).exec();
			uni.createSelectorQuery().in(this).select('.header').boundingClientRect(data => {
				this.HeaderBox = data.height
			}).exec();
			uni.createSelectorQuery().in(this).select('.zbqy').boundingClientRect(data => {
				this.ZbBox = data.height
			}).exec();
			uni.createSelectorQuery().in(this).select('.footBox').boundingClientRect(data => {
				this.footBoxHei = data.height
				//console.log(this.footBoxHei)
			}).exec();
			uni.createSelectorQuery().in(this).select('.navlist-list').boundingClientRect(data => {
				this.navListHei = data.height
				//console.log(this.footBoxHei)
			}).exec();

			var windowHeight = uni.getSystemInfoSync().windowHeight;
			//console.log(windowHeight);
			this.swiperHeight = windowHeight - this.navBar - this.HeaderBox
			//console.log(this.swiperHeight);
		
			let sysInfo = uni.getSystemInfoSync();
			this.screenWidth=sysInfo.screenWidth
			
		},
		onPageScroll: function(e) {
			if (e.scrollTop >= this.myScroll - this.navbarheight) {
				this.isFixed = true;
			} else {
				this.isFixed = false;
			}
		},
		mixins: [Autocomplete],
		methods: {
			// 使用引导
			guide() {
				const value = uni.getStorageSync('guidelaunchFlag');
				//console.log(value)
				if (!value || value == '') {
					this.syyd_show = true;
				} else {
					this.agreeBind();
				}
			},
			//同意条款加载
			agreeBind() {

				let user_agreebid = uni.getStorageSync("user_agreebid");
				//console.log("采招网隐私政策标识：" + user_agreebid);
				if (!user_agreebid || user_agreebid != true)
					this.popup_show = true;
			},
			//同意条款
			agreeBid() {
				uni.setStorageSync("user_agreebid", true);
				this.popup_show = false;
				this.loadHot(1);
			},
			//不同意条款
			notagreeBid() {
				uni.showModal({
					title: '提示',
					content: '是否退出采招网APP？',
					success: function(res) {
						if (res.confirm) {
							// 退出当前应用，改方法只在App中生效  
							if (uni.getSystemInfoSync().platform == 'ios') {
								plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
							} else if (uni.getSystemInfoSync().platform == 'android') {
								plus.runtime.quit();
							}
						} else if (res.cancel) {}
					}
				});
				return true //return true的意思是禁止返回到上一个界面
			},
			//更多功能跳转
			goPage(item) {
				if (!item.url) {
					uni.showToast({
						title: '正在开发中，敬请期待！',
						icon: "none"
					});
				} else {
					if (this.navigateFlag) {
						return;
					}
					this.navigateFlag = true;
					this.goToPage(item.ischecklogin, item.type, item.url)
					setTimeout(() => {
						this.navigateFlag = false;
					}, 200)
				}
			},
			clickSwiper(e){
				console.log(this.swiperImg,e)
				this.swiperImg.map((item,index)=>{
					if(index == e){
						this.goToPage(false, item.type, item.url)
					}
				})
			},
			hotPage(e) {
				uni.navigateTo({
					url: '/pages/search/searchList?keysword=' + encodeURIComponent(e)
				})
			},
			changeSwiper(e) {
				this.swiperCurrent = e.detail.current;
			},
			//获取分类
			loadTabbars() {
				let tabList = data_newstype.tabList;
				tabList.forEach(item => {
					item.indexnewsList = [];
					item.Status = 1; //加载更多 0加载前，1加载中，2没有更多了
					item.editModel = true;
					item.load = false;
				})
				this.indextabBars = tabList;
				this.loadNewsList('refresh');
			},
			showTemplete(index) {
				//console.log(index);
			},
			//信息列表
			loadNewsList(type) {
				let tabItem = this.indextabBars[this.tabCurrentIndex];
				//type add 加载更多 refresh下拉刷新
				if (type == 'add') {
					if (tabItem.Status === 2) {
						return;
					}
					tabItem.Status = 1;
				} else if (type == 'refresh') {
					//console.log('refresh')
					//console.log(this.indextabBars[this.tabCurrentIndex])
					//console.log(tabItem.indexnewsList)

					tabItem.Status = 1;
					tabItem.indexnewsList = []; //刷新前清空数组
				}
				//异步请求数据
				let data = this.initNewData();
				data.location = 4050;
				//data.areas = this.cityName;
				data.diqucode = this.cityCode;
				switch (this.tabCurrentIndex) {
					case 0:
					case 1:
					case 2:
					case 3:
					case 4:
					case 5:
					case 6:
					case 9:
					case 10:
					case 11:
						data.types = tabItem.value;
						data.pagesize = 5;
						if (!tabItem.page)
							tabItem.page = 0;
						tabItem.page++;
						data.page = tabItem.page;
						
						uni.request({
							url: this.baseConfig.serverURL + 'zhaobiao/SearchHandler.ashx', //检查更新的服务器地址
							data: data,
							method: "POST",
							header: {
								"content-type": "application/x-www-form-urlencoded" //"application/json"
							},
							success: (res) => {
								uni.hideToast();
								if (res.statusCode == 200) {
									if (!res.data.ret) {
										uni.showToast({
											title: res.data.msg,
											icon: "none"
										});
									} else {
										//获取成功，绑定
										let list = res.data.other2.list;
										list.forEach(item => {
											item.time = item.time.split('T')[0];
											tabItem.indexnewsList.push(item);
										})
										if (tabItem.indexnewsList.length > 0) {
											tabItem.load = true;
										}
										
										tabItem.editModel = false;
										tabItem.Status = 3;
									}
								} else {
									uni.showToast({
										title: '获取失败！',
										icon: "none"
									});
								}
							},
							fail: (res) => {
								uni.showToast({
									title: '获取失败，可能已超时！',
									icon: "none"
								});
							}
						})
						break;
					default:
						data.types = tabItem.value;
						data.pagesize = 4;
						if (!tabItem.page)
							tabItem.page = 0;
						tabItem.page++;
						data.page = tabItem.page;
						uni.request({
							url: this.baseConfig.serverURL + 'xiangmu/SearchHandler.ashx', //检查更新的服务器地址
							data: data,
							method: "POST",
							header: {
								"content-type": "application/x-www-form-urlencoded" //"application/json"
							},
							success: (res) => {
								uni.hideToast();
								if (res.statusCode == 200) {
									if (!res.data.ret) {
										uni.showToast({
											title: res.data.msg,
											icon: "none"
										});
									} else {
										//获取成功，绑定
										let list = res.data.other2.list;
										list.forEach(item => {
											item.time = item.time.split('T')[0];
											tabItem.indexnewsList.push(item);
										})
										if (tabItem.indexnewsList.length > 0) {
											tabItem.load = true;
										}
										tabItem.editModel = false;
										tabItem.Status = 3;
									}
								} else {
									uni.showToast({
										title: '获取失败！',
										icon: "none"
									});
								}
							},
							fail: (res) => {
								uni.showToast({
									title: '获取失败，可能已超时！',
									icon: "none"
								});
							}
						})
						break;
				}
			},
			//热搜词
			loadHot(ly) {
				//异步请求数据
				let data = this.initNewData();
				data.location = 4050;
				data.ly = ly || 0;
				uni.request({
					url: this.baseConfig.serverURL + 'index/indexBindHandler.ashx', //检查更新的服务器地址
					data: data,
					method: "POST",
					header: {
						"content-type": "application/x-www-form-urlencoded" //"application/json"
					},
					success: (res) => {
						if (res.statusCode == 200) {
							if (!res.data.ret) {
								if (ly != 1)
									uni.showToast({
										title: res.data.msg,
										icon: "none"
									});
							} else {

								if (ly == 1) {
									if (res.data.other2.adbig && res.data.other2.adbig.info && res.data.other2
										.adbig.info.length > 0) {
										this.Adbig.info = res.data.other2.adbig.info[0];
										this.Adbig.mustlogin = res.data.other2.adbig.mustlogin;
										this.Adbig.enddate = res.data.other2.adbig.enddate;
									}
									if (res.data.other2.adsmall && res.data.other2.adsmall.info && res.data
										.other2
										.adsmall.info.length > 0) {
										this.Adsmall.info = res.data.other2.adsmall.info[0];
										this.Adsmall.mustlogin = res.data.other2.adsmall.mustlogin;
										this.Adsmall.enddate = res.data.other2.adsmall.enddate;
									}
									if (this.Adbig.info.src != '' && !this.isshowadbig && this.isshowTopAd(this
											.Adbig.enddate)) {
										this.$nextTick(() => {
											this.$refs['showPopAd'].open();
											this.isshowadbig = true;
										})
									}
								} else {
									//获取成功，绑定
									if (res.data.other2.list != undefined && res.data.other2.list.length > 0) {
										this.hotlist = res.data.other2.list
									}
									console.log(res.data.other2.list)
									if (res.data.other2.wordlist != undefined && res.data.other2.wordlist
										.length >
										0) {
										this.wordlist = res.data.other2.wordlist;
									}
									let list_gg = res.data.other2.list_gg;
									if (list_gg != undefined && list_gg.length > 0) {
										this.swiperImg = list_gg;
									}
								}
							}
						} else {
							uni.showToast({
								title: '获取失败！',
								icon: "none"
							});
						}
					},
					fail: (res) => {
						uni.showToast({
							title: '获取失败，可能已超时！',
							icon: "none"
						});
					}

				})
			},
			//详情
			navToDetails(item) {
				this.clickedid.push(item.id);
				let url = "";
				let uri = encodeURIComponent(JSON.stringify(item));
				switch (item.type) {
					case 3:
					case 10:
					case 11:
					case 12:
					case 13:
					case 14:
					case 98:
					case 99:
						if (this.tabCurrentIndex == 0) {
							uni.navigateTo({
								url: '/pages/xiangmu/detail?ly=search&data=' + encodeURIComponent(uri)
							})
						} else {
							uni.navigateTo({
								url: '/pages/xiangmu/detail?ly=index&data=' + encodeURIComponent(uri)
							})
						}
						break;
					default:
						uni.navigateTo({
							url: '/pages/zhaobiao/detail?ly=index&data=' + encodeURIComponent(uri)
						})
						break;
				}
			},
			// 中标详情
			zhongbiaoDetail(item) {
				let uri = encodeURIComponent(JSON.stringify(item));
				uni.navigateTo({
					url: '/pages/zhaobiao/detail?ly=index&data=' + encodeURIComponent(uri)
				})
			},
			//设置scroll-view是否允许滚动，在小程序里下拉刷新时避免列表可以滑动
			setEnableScroll(enable) {
				if (this.enableScroll !== enable) {
					this.enableScroll = enable;
				}
			},

			//tab切换
			async changeTab(e) {
				if (scrollTimer) {
					//多次切换只执行最后一次
					clearTimeout(scrollTimer);
					scrollTimer = false;
				}
				let index = e;
				//e=number为点击切换，e=object为swiper滑动切换
				if (typeof e === 'object') {
					index = e.detail.current
				}
				if (typeof tabBar !== 'object') {
					tabBar = await this.getElSize("nav-bar")
				}
				//计算宽度相关
				let tabBarScrollLeft = tabBar.scrollLeft;
				let width = 0;
				let nowWidth = 0;
				//获取可滑动总宽度
				for (let i = 0; i <= index; i++) {
					let result = await this.getElSize('tab' + i);
					width += result.width;
					if (i === index) {
						nowWidth = result.width;
					}
				}
				if (typeof e === 'number') {
					//点击切换时先切换再滚动tabbar，避免同时切换视觉错位
					this.tabCurrentIndex = index;
				}
				//延迟300ms,等待swiper动画结束再修改tabbar
				scrollTimer = setTimeout(() => {
					if (width - nowWidth / 2 > windowWidth / 2) {
						//如果当前项越过中心点，将其放在屏幕中心
						this.scrollLeft = width - nowWidth / 2 - windowWidth / 2;
					} else {
						this.scrollLeft = 0;
					}
					if (typeof e === 'object') {
						this.tabCurrentIndex = index;
					}
					this.tabCurrentIndex = index;
					//this.loadNewsList('city');
					//第一次切换tab，动画结束后需要加载数据
					let tabItem = this.indextabBars[this.tabCurrentIndex];
					if (tabItem.load != true) {
						tabItem.editModel = true;
						//tabItem.load = true;
						this.loadNewsList('refresh');
					}
				}, 300)
			},
			//获得元素的size
			getElSize(id) {
				return new Promise((res, rej) => {
					let el = uni.createSelectorQuery().select('#' + id);
					el.fields({
						size: true,
						scrollOffset: true,
						rect: true
					}, (data) => {
						res(data);
					}).exec();
				});
			},
			//是否是今天
			isToday(str) {
				return new Date().getTime() - new Date(str).getTime() < 86400000;
			},
			//显示招标模板
			tabShowZb(tabIndex) {
				switch (tabIndex) {
					case 0:
					case 1:
					case 2:
					case 3:
					case 4:
					case 5:
					case 6:
					case 9:
					case 10:
					case 11:
						return true;
					default:
						return false;
				}
			},
			
			searchPage() {
				let keywords = this.keywords
				uni.navigateTo({
					url: '/pages/search/searchList?keysword=' + encodeURIComponent(keywords)
				})
			},
			confirm() {
				this.searchPage();
			},
			MoreInforList(type) {
				uni.navigateTo({
					url: '/pages/zhaobiao/list?type=' + type
				})
			},
			gotourl(type, url) {
				if (type == 'tab') {
					uni.switchTab({
						url: url
					})
				} else if (type == 'nav') {

					uni.navigateTo({
						url: url
					})
				}
			},
			goToPage(checklogin, type, url) {
				if (url.indexOf('/pages/user/huiyuan/payment') != -1)
					checklogin = true;
				if (checklogin) {
					this.checkLogin();
					if (this.currUser.islogin) {
						this.gotourl(type, url)
					} else {
						url = encodeURIComponent(url);
						uni.navigateTo({
							url: '/pages/user/login/login1?type=' + type + '&fromurl=' + encodeURIComponent(url)
						})
					}
				} else {
					this.gotourl(type, url)
				}
			},
			launchFlag: function() {
				/**
				 * 向本地存储中设置launchFlag的值，即启动标识；
				 */
				uni.setStorage({
					key: 'guidelaunchFlag',
					data: true
				});
				this.syyd_show = false;
				this.popup_show = true;
			},
			NextStep() {
				this.IsShow1 = false;
				this.IsShow2 = true;
			},
			NextStep2() {
				this.IsShow2 = false;
				this.IsShow3 = true;
			},
			NextStep3() {
				this.IsShow3 = false;
				this.IsShow4 = true;
			},
			NextStep4() {
				this.IsShow4 = false;
				this.IsShow5 = true;
			},
			NextStep5() {
				uni.setStorage({
					key: 'guidelaunchFlag',
					data: true
				});
				this.IsShow5 = false;
				this.IsShow1 = false;
				this.syyd_show = false;
				this.popup_show = true;
			},
			isInArray(arr, value) {
				for (var i = 0; i < arr.length; i++) {
					if (value === arr[i]) {
						return true;
					}
				}
				return false;
			},
			fuwutiaokuan() {
				uni.navigateTo({
					url: "/pages/index/webview/common-webview?weburl=https://www.bidcenter.com.cn/help/fwtk.shtml"
				})
			},
			yinsixieyi() {
				uni.navigateTo({
					url: "/pages/index/webview/common-webview?weburl=https://www.bidcenter.com.cn/help/fwtk.shtml"
				})
			},
			searchByCompleteKeyWord(keyword) {
				this.keywords = keyword;
				this.AutocompleteList = [];
				uni.navigateTo({
					url: '/pages/search/searchList?keysword=' + encodeURIComponent(this.keywords)
				})
			},
			isshowTopAd(enddate) {
				let nowdate = dateutil.getTime(0);
				if (dateutil.after(enddate, nowdate)) {
					return false;
				}
				return true;
			},

			scan(checklogin) {
				if (!checklogin) {
					this.checkLogin();
					if (!this.currUser.islogin) {
						uni.navigateTo({
							url: '/pages/user/login/login1?type=tab&fromurl=' + encodeURIComponent(
								'/pages/index/index')
						})
					} else {
						let that = this;
						console.log('ddd',uni.getSystemInfoSync().platform == 'android' && plus.navigator.checkPermission('CAMERA') ===
							'undetermined')
						if (uni.getSystemInfoSync().platform == 'android' && plus.navigator.checkPermission('CAMERA') ===
							'undetermined') {
							// uni.showModal({
							// 	title: "相机权限使用说明：",
							// 	// 获取摄像头权限主要用于扫描登陆采招网PC端；
							// 	// 将申请相机权限，用于扫码功能
							// 	content: "主要用于扫描登陆采招网PC端",
							// 	confirmText: '知道了',
							// 	showCancel: false,
							// 	success: (res) => {
							// 		if (res.confirm) {
							// 			// 唤起相册、相机、扫码、地理位置之类的api，如：uni.scanCode  
							// 			this.scanFn()
							// 		}
							// 	}
							// })
							// 华为市场审核需要
							plus.nativeUI.alert('获取相机权限主要用于扫描登陆采招网PC端', function() {
								that.scanFn()
							});

						} else {
							this.scanFn()
						}
					}
				} else {
					uni.reLaunch({
						url: '/pages/index/index'
					})
				}
			},
			scanFn() {
				const me = this;
				uni.scanCode({
					onlyFromCamera: true,
					scanType: ['qrCode'],
					success: function(result) {
						var obj = result;
						console.log("二维码内容", obj.result)
						if (obj.result) {
							let data = me.initNewData();
							data.from = 4038;
							data.result = obj.result;
							data.scantype = obj.scanType;
							data.location = 4050;
							uni.request({
								//url: 'http://192.168.1.221:8077/JsonHandler/CheckErweimaHandler.aspx', //检查更新的服务器地址
								url: 'https://sso.bidcenter.com.cn/JsonHandler/CheckErweimaHandler.aspx', //检查更新的服务器地址
								data: data,
								method: "POST",
								header: {
									"content-type": "application/x-www-form-urlencoded" //"application/json"
								},
								success: (res) => {
									if (res.statusCode == 200) {
										if (!res.data.ret) {
											uni.showToast({
												title: res.data
													.msg,
												icon: "none"
											});
											return;
										} else {
											uni.redirectTo({
												url: '/pages/index/scanLogin?result=' +
													obj.result + '&scantype=' + obj
													.scanType + '&isshixiao=' + res
													.data.retbs
											})
											//成功
											// if (res.data.msg) {
											// 	uni.showToast({
											// 		title: res
											// 			.data
											// 			.msg,
											// 		icon: "none"
											// 	});
											// }
										}
									} else {
										uni.showToast({
											title: '二维码验证失败！',
											icon: "none"
										});
									}
								},
								fail: (res) => {
									uni.showToast({
										title: '二维码验证出错！',
										icon: "none"
									});
								}
							})
						} else {
							uni.showToast({
								title: '二维码错误！',
								icon: "none"
							});
						}
					},
					fail() {
						// uni.showToast({
						// 	title: '取消扫码！',
						// 	icon: "none"
						// });
					}
				})
			}


		}
	}
</script>

<style lang='scss'>
	@import "@/static/css/index.scss";

	.container {
		height: 100%;
	}

	.popup_layer {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		right: 0;
		z-index: 10000;
		display: none;
	}

	.popup_layer.popup_show {
		display: block;
	}

	.popup_bg {
		width: 100%;
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		right: 0;
		background-color: rgba($color: #000000, $alpha: 0.6);
	}

	.promptPop {
		width: 90%;
		background-color: #fff;
		position: absolute;
		padding-bottom: 30rpx;
		border-radius: 20rpx;
	}

	.prompt-title {
		font-size: 36rpx;
		text-align: center;
		padding: 40rpx 0;
	}

	.prompt-text {
		padding: 0 40rpx;
	}

	.prompt-text .prompt-text-infor {
		padding: 0;
		margin: 0;
		font-size: 30rpx;
		color: #333;
		margin-bottom: 20rpx;
		line-height: 50rpx;
	}

	.prompt-btn {
		padding: 0 40rpx;
		background: #fff;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		width: 100%;
		box-sizing: border-box;

		.prompt-btn-agree1 {
			width: 45%;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			background-color: #fff;
			border: 1px solid #ff6631;
			border-radius: 40rpx;
			color: #FF6631;
			font-size: 32rpx;
			text-decoration: none;
		}

		.prompt-btn-agree2 {
			width: 45%;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			border-radius: 40rpx;
			color: #FF6631;
			font-size: 32rpx;
			text-decoration: none;
			background-color: #FF6631;
			color: #FFFFFF;
			margin-left: 1rem;
		}
	}

	.uni-navbar__header-btns {
		width: 0;
	}

	.swiper-box {
		height: 100%;
		padding-bottom: 220rpx;
	}

	.xmlist-tag {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: flex-start;
		margin-top: 20rpx;

		.xmlist-tag-item {
			padding: 10rpx;
			font-size: 24rpx;
			background-color: #eff0f5;
			color: #5f6b93;
			border-radius: 8rpx;
			margin-right: 10rpx;
		}

		.xmlist-tag-item-gj {
			background-color: #eaf2ff;
			color: #306ae0;
		}
	}

	.xmlist-bottom {
		margin-top: 20rpx;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
		border-top: 1px solid #efefef;
		padding-top: 20rpx;

		.xmlist-area {
			color: #a4a4a4;
			font-size: 26rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			margin-right: 20rpx;

			image {
				width: 40rpx;
				height: 39rpx;
				margin-right: 10rpx;
			}
		}
	}

	.title {
		font-size: 32rpx;
		color: #303133;
		line-height: 45rpx;
		min-height: 44px;
	}

	.moreList {
		display: none;
	}

	.navbarFixed {
		position: fixed;
		width: 100%;
		z-index: 999;
		top: 200px;
	}

	.searchFixed {
		position: fixed;
		top: 0;
		width: 100%;
		z-index: 999;
	}

	.jumpover,
	.experience {
		position: absolute;
		z-index: 999;
		height: 60rpx;
		line-height: 60rpx;
		padding: 0 40rpx;
		font-size: 32rpx;
		color: #fff;
		border: 2rpx solid #fff;
		border-radius: 30rpx;
	}

	.jumpover {
		right: 30rpx;
		top: 80rpx;
	}

	.experience {
		right: 50%;
		bottom: 100rpx;
		margin-right: -116rpx;
		background-color: #fff;
		color: #2F69E0;
	}

	.syyd-content {
		position: relative;
		width: 100%;
		height: 100%;
	}

	.syyd-step1,
	.syyd-step2,
	.syyd-step3,
	.syyd-step4,
	.syyd-step5 {
		width: 100%;
		position: absolute;
	}

	.syyd-step1-img {
		width: 100%;
	}

	.syyd-step3 {}

	.syyd-step4,
	.syyd-step5 {
		bottom: 0;
	}

	.showImg {
		display: block;
	}

	.hideImg {
		display: none;
	}

	.wenxintishi-cont {
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		right: 0;
	}

	.welfare {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		z-index: 9999;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.welfare_cont {
		width: 100%;
		height: 913rpx;
	}

	.welfare_cont .activity-pic {
		width: 100%;
		height: 913rpx;
	}

	.receive-close {
		width: 62rpx;
		height: 62rpx;
	}

	.lijilingqu {
		display: block;
		position: absolute;
		bottom: 150rpx;
		width: 258rpx;
		animation: lijilingqu 2s alternate infinite;
	}

	.lijilingqu .lijilingqu-btn {
		height: 64rpx;
		width: 258rpx;
	}

	.welfare-small {
		position: fixed;
		right: 0;
		bottom: 150rpx;
		z-index: 10000;
	}

	.welfare-small .welfare-box {
		display: block;
		width: 276rpx;
		height: 246rpx;
		animation: move 2.5s .15s linear infinite;
	}

	.welfare-small .welfare-box image {
		width: 276rpx;
		height: 246rpx;
	}

	@keyframes lijilingqu {
		0% {
			transform: scale(1);
		}

		12.5% {
			transform: scale(1.05);
		}

		25% {
			transform: scale(1);
		}

		37.5% {
			transform: scale(1.05);
		}

		50% {
			transform: scale(1);
		}

		100% {
			transform: scale(1);
		}
	}

	@keyframes move {
		10% {
			transform: rotate(15deg);
		}

		20% {
			transform: rotate(-10deg);
		}

		30% {
			transform: rotate(5deg);
		}

		40% {
			transform: rotate(-5deg);
		}

		50%,
		100% {
			transform: rotate(0deg);
		}
	}

	.input-view {
		position: relative;
	}

	.search-history {
		position: absolute;
		left: 0;
		background-color: #FFFFFF;
		top: 2.7em;
		width: 100%;
		z-index: 999;
		border-radius: 10rpx;
		/* height: 398rpx; */
		max-height: 398rpx;
		overflow-y: scroll;
		padding-bottom: 20rpx;
		box-shadow: 0 3px 5px rgba(0, 0, 0, 0.5);

		.history-list {
			padding: 23rpx 30rpx;
			font-size: 28rpx;
			position: relative;

			&::after {
				content: '';
				position: absolute;
				left: 30rpx;
				right: 30rpx;
				height: 1px;
				bottom: 0;
				background-color: #EEEEEE;
			}
		}
	}

	.scan-box {
		position: relative;

		.scan-text {
			width: 90rpx;
			height: 35rpx;
			line-height: 30rpx;
			background-color: #ff0000;
			border-radius: 10rpx;
			border-bottom-right-radius: 0px;
			font-size: 24rpx;
			color: #FFFFFF;
			position: absolute;
			top: 12rpx;
			right: 30rpx;
			text-align: center;
		}
	}

	.header {
		background-color: #1B18F7 !important;
	}
</style>